package org.dlow.invoke;

import org.dlow.common.constants.RpcInvoker;
import org.dlow.spi.ExtensionLoader;

import java.io.IOException;

/**
 * @description:
 * @Author: 山沐与山
 * @CreateTime: 2024-05-10 16:59
 */
public class ExecutorFactory {


    public static MethodExecutor get(RpcInvoker rpcInvoker){
        return ExtensionLoader.getInstance().get(rpcInvoker.name);
    }

    public static MethodExecutor get(String name){

        return ExtensionLoader.getInstance().get(name);
    }

    public static void init() throws IOException, ClassNotFoundException {
        ExtensionLoader.getInstance().loadExtension(MethodExecutor.class);
    }
}
